<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020-06-21
  Time: 23:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>

    <%
        String path = request.getContextPath();
// 获得项目完全路径（假设你的项目叫MyApp，那么获得到的地址就是

//http://localhost:8080/SpringMVC01/）:
        String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>

    <!--现在一个问题是，HTML页面一旦经过重定向或者其他请求，那么就会拿不到预先导入的静态资源-->
    <title>login登录页面</title>
    <base href=" <%=basePath%>">
    <!-- Meta-Tags -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="keywords" content="Existing Login Form Widget Responsive, Login Form Web Template, Flat Pricing Tables, Flat Drop-Downs, Sign-Up Web Templates, Flat Web Templates, Login Sign-up Responsive Web Template, Smartphone Compatible Web Template, Free Web Designs for Nokia, Samsung, LG, Sony Ericsson, Motorola Web Design">


    <link href="static/css/popuo-box.css" rel="stylesheet" type="text/css" media="all" />

    <!-- Style -->
    <link rel="stylesheet" href="static/css/style.css" type="text/css" media="all">


</head>
<body>

<h1>login登录页面</h1>

<div class="w3layoutscontaineragileits">
    <h2>在这里登录</h2>
    <form action="user/login.do" method="post">
        <input type="text" name="userName" placeholder="USERNAME" required>
        <input type="password" name="userPassword" placeholder="PASSWORD" required>
        <ul class="agileinfotickwthree">
            <li>
                <input type="checkbox" id="brand1" value="">
                <label for="brand1"><span></span>记住</label>
                <a href="#">忘记密码?</a>
            </li>
        </ul>
        <div class="aitssendbuttonw3ls">
            <input type="submit" value="登录">
            <p> 注册一个新账户 <span>→</span> <a class="w3_play_icon1" href="#small-dialog1"> 点击这里</a></p>
            <div class="clear"></div>
        </div>
    </form>
</div>

<%--
    对后端返回的信息进行对比，显示不同的弹框信息
--%>
<%
    if((String) request.getAttribute("success") == "register fail"){
%>
<script>
    alert("注册失败，用户名已存在");
</script>
<%
    }else if ((String) request.getAttribute("success") == "register success"){
%>
<script>
    alert("注册成功");
</script>
<%
    }
%>

<%
    if((String) request.getAttribute("information") == "login fail"){
%>
<script>
    alert("登录失败");
</script>
<%--<%
}else if ((String) request.getAttribute("information") == "login success"){
%>
<script>
    alert("登录成功");
</script>--%>
<%
    }
%>

<!-- for register popup -->
<div id="small-dialog1" class="mfp-hide">
    <div class="contact-form1">
        <div class="contact-w3-agileits">
            <h3>注册表单</h3>
            <form action="user/register.do" method="post">
                <div class="form-sub-w3ls">
                    <input name="userName" placeholder="User Name" type="text" required>
                    <div class="icon-agile">
                        <i class="fa fa-user" aria-hidden="true"></i>
                    </div>
                </div>
                <div class="form-sub-w3ls">
                    <input name="userEmail" placeholder="Email" class="mail" type="email" required>
                    <div class="icon-agile">
                        <i class="fa fa-envelope-o" aria-hidden="true"></i>
                    </div>
                </div>
                <div class="form-sub-w3ls">
                    <input name="userPassword" placeholder="Password" type="password" required>
                    <div class="icon-agile">
                        <i class="fa fa-unlock-alt" aria-hidden="true"></i>
                    </div>
                </div>
                <div class="form-sub-w3ls">
                    <input placeholder="Confirm Password" type="password" required>
                    <div class="icon-agile">
                        <i class="fa fa-unlock-alt" aria-hidden="true"></i>
                    </div>
                </div>
                <div class="login-check">
                    <label class="checkbox"><input type="checkbox" name="checkbox" checked="">I Accept Terms & Conditions</label>
                </div>
                <div class="submit-w3l">
                    <input type="submit" value="Register">
                </div>
            </form>
        </div>
    </div>
</div>

<script type="text/javascript" src="static/js/jquery-2.1.4.min.js"></script>

<!-- pop-up-box-js-file -->
<script src="static/js/jquery.magnific-popup.js" type="text/javascript"></script>
<!--//pop-up-box-js-file -->
<script>
    $(document).ready(function () {
        $('.w3_play_icon,.w3_play_icon1,.w3_play_icon2').magnificPopup({
            type: 'inline',
            fixedContentPos: false,
            fixedBgPos: true,
            overflowY: 'auto',
            closeBtnInside: true,
            preloader: false,
            midClick: true,
            removalDelay: 300,
            mainClass: 'my-mfp-zoom-in'
        });

    });


    /*window.onload = function () {
        var information = ${success}
        if (information == "注册失败，用户名已存在"){
            alert("注册失败，用户名已存在");
        }else if (information == "注册成功"){
            alert("注册成功");
        }
    }*/

</script>

</body>
</html>
